<template>
  <div>
    <p ref="p">{{ num }}</p>
    <br />
    <button @click="dianji" ref="btn">点击</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: 0,
    };
  },
  methods: {
    dianji() {
      this.num++;
      this.$nextTick(() => {
        console.log(this.$refs.p.innerHTML);
      });
    },
  },
//   updated(){
//       console.log(this.$refs.p.innerHTML);
//   }
};
</script>

<style>
</style>